package com.xiaoquan.gulimall.auth.feign;

import com.xiaoquan.common.utils.R;
import com.xiaoquan.gulimall.auth.vo.SocialUser;
import com.xiaoquan.gulimall.auth.vo.UserLoginVo;
import com.xiaoquan.gulimall.auth.vo.UserRegisterVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient("gulimall-member")
public interface MemberFeignService {
    /**
     * 会员注册
     * @param vo
     * @return
     */
    @RequestMapping("/member/member/register") // 微服务之间都是 http + json 数据 所以要加@RequestBody 将数据转换成对象MemberRegisterVo
    public R register(@RequestBody UserRegisterVo vo);

    /**
     * 会员登录
     * @param vo
     * @return
     */
    @PostMapping("/member/member/login")
    public R login(@RequestBody UserLoginVo vo);

    /**
     * 社交用户登录或者注册
     * @param socialUser
     * @return
     * @throws Exception
     */
    @PostMapping("/member/member/oauth2/login")
    public R oauthlogin(@RequestBody SocialUser socialUser) throws Exception;

}
